﻿
<script src="~/Scripts/jquery-easyui-extensions/combobox/jeasyui.fixeds.combobox.groupField.js"></script>

<div class="easyui-panel" data-options="fit:true" style="padding:30px;">
    <input id="com1" type="text" value="" />&nbsp;&nbsp;<span style="color:red;">源生的combobox。存在bug</span>
    <br /><br /><br /><br />
    <input id="com2" type="text" value="" />&nbsp;&nbsp;<span style="color:red;">修复后的combobox，采用 loadData 方式加载本地数据</span>
    <br /><br /><br /><br />
    <input id="com3" type="text" value="" />&nbsp;&nbsp;<span style="color:red;">修复后的combobox，采用 url 方式加载远程数据</span>
</div>

<script>
    $(function () {

        var data2 = [{
            "value": "111",
            "text": "Firefox 2.0 or higher",
            "group": "yx"
        }, {
            "value": "222",
            "text": "yx1的项1",
            "group": "yx1"
        }, {
            "value": "333",
            "text": "Opera 9.0 or higher",
            "group": "yx"
        }, {
            "value": "444",
            "text": "yx1的项2",
            "group": "yx1"
        }];

        $("#com1").combobox({
            valueField: 'value',
            textField: 'text',
            groupField: 'group',
            method: "get",
            url: "/Jsons/combobox/combobox-group-data.json",
            loader: $.fn.combobox.extensions.original._loader
        });

        $("#com2").combobox({
            valueField: 'value',
            textField: 'text',
            groupField: 'group'
        });

        $("#com2").combobox("loadData", data2);

        $("#com3").combobox({
            valueField: 'value',
            textField: 'text',
            groupField: 'group',
            method: "get",
            url: "/Jsons/combobox/combobox-group-data.json"
        });
    });
</script>